//
// Created by Administrator on 2023/7/31.
//
#include <vector>
#include <iostream>

using namespace std;

class Solution {
public:
    int sumOfSquares(vector<int> &nums) {
        int n = nums.size();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (n % (i + 1) == 0)
                ans += nums[i] * nums[i];
        }
        return ans;
    }
};

int main() {
    vector<int> nums1{1, 2, 3, 4};
    vector<int> nums2{2, 7, 1, 19, 18, 3};
    Solution s;
    cout << s.sumOfSquares(nums1) << endl;
    cout << s.sumOfSquares(nums2) << endl;
}